
<%= simple_form_for(@partner) do |f| %>
  <%= f.error_notification %>
  <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>

  <%= render 'layouts/flash_messages' %>

  <div class="row">

    <div class="col-md-4">
      <%= f.input :code, label: '往来单位编码' %>
    </div>
    <div class="col-md-4">
      <%= f.input :name, label: '往来单位名称' %>
    </div>
    <div class="col-md-4">
      <%= f.input :shortname, label: '简称' %>
    </div>
  </div>

  <div class="row">
    <div class="col-md-4">
      <%= f.association :partner_category, label: '所属类别' %>
    </div>
    <div class="col-md-4">
      <%= f.input :payable_partner_id, label: '结算客户', collection: Partner.all.map{|c| [c.name, c.id]} %>
    </div>
  </div>

  <div class="row">
    <div class="col-md-4">
      <%= f.input :address, label: '单位地址' %>
    </div>
    <div class="col-md-4">
      <%= f.input :tel, label: '电话' %>
    </div>
    <div class="col-md-4">
      <%= f.input :fax, label: '传真' %>
    </div>
  </div>

  <div class="row">
    <div class="col-md-4">
      <%= f.input :bank, label: '开户银行' %>
    </div>
    <div class="col-md-4">
      <%= f.input :bank_account, label: '银行账号' %>
    </div>
    <div class="col-md-4">
      <%= f.input :bank_address, label: '开户行地址' %>
    </div>
  </div>

  <div class="row">
    <div class="col-md-4">
      <%= f.input :tax_no, label: '税号' %>
    </div>
    <div class="col-md-4">
      <%= f.input :deputy_depart_id, label: '分管部门' %>
    </div>
    <div class="col-md-4">
      <%= f.input :sales_id, label: '分管人员' %>
    </div>
  </div>

    <table class="table table-striped table-hover table-bordered dataTable no-footer">
      <thead>
        <tr>
          <td>收货地址</td>
          <td>联系人</td>
          <td>联系人手机</td>
          <td></td>
        </tr>
      </thead>
      <tbody>
      <%= f.simple_fields_for :contacts  do |task| %>
        <%= render 'contact_fields', :f => task %>
      <% end %>

      </tbody>
    </table>



  <div class="form-actions">
    <%= f.button :submit,'提交', class: 'btn btn-blue btn-xs' %>
  </div>
<% end %>
